/*
 * Copyright (C) 2014 Snark
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package dominions.pkg4.mod.editor;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Scalie
 */
public class RestoreDefaults {

    
    public static void Restore()
    {
        List<Armor> armorList = new ArrayList<Armor>();
        
        /*
        Armors
        */
        Armor temp = new Armor();
        /*
        Leathers
        */
       ////
        
        temp = new Armor("Leather", "standard/leathercuirass.png", "0", null , "Human, Machakan, Lizard", "standard");
        armorList.add(temp);
        temp = new Armor("Leather 2", "standard/leathercuirass2.png", "0", null, "Human, Machakan, Lizard", "standard");
        armorList.add(temp);
        temp = new Armor("Leather Hauberk", "standard/leatherhauberk.png", "0", null, "Human, Machakan, Lizard", "standard");
        armorList.add(temp);
        temp = new Armor("Leather Hauberk 2", "standard/leatherhauberk2.png", "0", null, "Human, Machakan, Lizard", "standard");
        armorList.add(temp);
        temp = new Armor("Mail Cuirass", "standard/mailcuirass.png", "0", null, "Human, Machakan, Lizard", "standard");
        armorList.add(temp);
        temp = new Armor("Mail Hauberk", "standard/mailhauberk.png", "0", null, "Human, Machakan, Lizard", "standard");
        armorList.add(temp);
        temp = new Armor("Mail Hauberk 2", "standard/mailhauberk2.png", "0", null, "Human, Machakan, Lizard", "standard");
        armorList.add(temp);
        temp = new Armor("Plate Cuirass", "standard/platecuirass.png", "0", null, "Human, Machakan, Lizard", "standard");
        armorList.add(temp);
        temp = new Armor("Plate Hauberk", "standard/platehauberk.png", "0", null, "Human, Machakan, Lizard", "standard");
        armorList.add(temp);
        temp = new Armor("Ring Cuirass", "standard/ringcuirass.png", "0", null, "Human,Machakan, Lizard", "standard");
        armorList.add(temp);
        temp = new Armor("Ring Hauberk", "standard/ringhauberk.png", "0", null, "Human, Machakan, Lizard", "standard");
        armorList.add(temp);
        temp = new Armor("Ring Hauberk 2", "standard/ringhauberk2.png", "0", null, "Human, Machakan, Lizard", "standard");
        armorList.add(temp);
        
        temp = new Armor("Leather", "2h/leathercuirass.png", "0", null , "Human, Machakan, Lizard", "2h");
        armorList.add(temp);
        temp = new Armor("Leather 2", "2h/leathercuirass2.png", "0", null, "Human, Machakan, Lizard", "2h");
        armorList.add(temp);
        temp = new Armor("Leather Hauberk", "2h/leatherhauberk.png", "0", null, "Human, Machakan, Lizard", "2h");
        armorList.add(temp);
        temp = new Armor("Leather Hauberk 2", "2h/leatherhauberk2.png", "0", null, "Human, Machakan, Lizard", "2h");
        armorList.add(temp);
        temp = new Armor("Mail Cuirass", "2h/mailcuirass.png", "0", null, "Human, Machakan, Lizard", "2h");
        armorList.add(temp);
        temp = new Armor("Mail Hauberk", "2h/mailhauberk.png", "0", null, "Human, Machakan, Lizard", "2h");
        armorList.add(temp);
        temp = new Armor("Mail Hauberk 2", "2h/mailhauberk2.png", "0", null, "Human, Machakan, Lizard", "2h");
        armorList.add(temp);
        temp = new Armor("Plate Cuirass", "2h/platecuirass.png", "0", null, "Human, Machakan, Lizard", "2h");
        armorList.add(temp);
        temp = new Armor("Plate Hauberk", "2h/platehauberk.png", "0", null, "Human, Machakan, Lizard", "2h");
        armorList.add(temp);
        temp = new Armor("Ring Cuirass", "2h/ringcuirass.png", "0", null, "Human,Machakan, Lizard", "2h");
        armorList.add(temp);
        temp = new Armor("Ring Hauberk", "2h/ringhauberk.png", "0", null, "Human, Machakan, Lizard", "2h");
        armorList.add(temp);
        temp = new Armor("Ring Hauberk 2", "2h/ringhauberk2.png", "0", null, "Human, Machakan, Lizard", "2h");
        armorList.add(temp);
        
        temp = new Armor("Leather Hauberk", "archer/leatherhauberk.png", "0", null, "Human, Machakan, Lizard", "archer");
        armorList.add(temp);
        temp = new Armor("Leather Hauberk 2", "archer/leatherhauberk2.png", "0", null, "Human, Machakan, Lizard", "archer");
        armorList.add(temp);
        temp = new Armor("Mail Hauberk", "archer/mailhauberk.png", "0", null, "Human, Machakan, Lizard", "archer");
        armorList.add(temp);
        temp = new Armor("Mail Hauberk 2", "archer/mailhauberk2.png", "0", null, "Human, Machakan, Lizard", "archer");
        armorList.add(temp);
        temp = new Armor("Plate Hauberk", "archer/platehauberk.png", "0", null, "Human, Machakan, Lizard", "archer");
        armorList.add(temp);
        temp = new Armor("Ring Hauberk", "archer/ringhauberk.png", "0", null, "Human, Machakan, Lizard", "archer");
        armorList.add(temp);
        temp = new Armor("Ring Hauberk 2", "archer/ringhauberk2.png", "0", null, "Human, Machakan, Lizard", "archer");
        armorList.add(temp);
        
        ObjectOutputStream out = null;
        
        
        for(Armor test : armorList)
        {
            test.path.substring(0, test.path.lastIndexOf("/"));
        try {
            out = new ObjectOutputStream(new FileOutputStream("armordata/" + test.path.substring(0, test.path.lastIndexOf("/")) + "/" + test.name + ".ser"));
            out.writeObject(test);
            out.close();
        } catch (IOException ex) {
            System.out.println(ex);
        }
        }       
        armorList.clear();
        
        /*
            Pants
        */
        temp = new Armor("Chain Pants" , "leg/chainpants.png", "0", null, "Human, Machakan", null);
        armorList.add(temp);
        temp = new Armor("Leather Pants" , "leg/leatherpants.png", "0", null, "Human, Machakan", null);
        armorList.add(temp);
        temp = new Armor("Pants" , "leg/pants.png", "0", null, "Human, Machakan", null);
        armorList.add(temp);
        temp = new Armor("Plate Pants" , "leg/platepants.png", "0", null, "Human, Machakan", null);
        armorList.add(temp);
        temp = new Armor("Ring Pants" , "leg/ringpants.png", "0", null, "Human, Machakan", null);
        armorList.add(temp);
        
        for(Armor test : armorList)
        {
            test.path.substring(0, test.path.lastIndexOf("/"));
        try {
            out = new ObjectOutputStream(new FileOutputStream("armordata/" + test.path.substring(0, test.path.lastIndexOf("/")) + "/" + test.name + ".ser"));
            out.writeObject(test);
            out.close();
        } catch (IOException ex) {
            System.out.println(ex);
        }
        }       
        armorList.clear();
        
        
        temp = new Armor("Chain Pants-Lizard" , "leg/Lizard/legarmor.png", "0", null, "Lizard", null);
        armorList.add(temp);
        
                for(Armor test : armorList)
        {
            test.path.substring(0, test.path.lastIndexOf("/"));
        try {
            out = new ObjectOutputStream(new FileOutputStream("armordata/" + test.path.substring(0, test.path.lastIndexOf("/")) + "/" + test.name + ".ser"));
            out.writeObject(test);
            out.close();
        } catch (IOException ex) {
            System.out.println(ex);
        }
        }       
        armorList.clear();
        
        
        
        

        }
    }
    
